// $Id: server.h 81 2011-04-24 07:37:10Z cedric.shih@gmail.com $
/*
 * Copyright (C) 2011 Cedric Shih <cedric.shih@gmail.com>
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as published by
 * the Free Software Foundation; either version 2.1 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 */

#ifndef SERVER_H_
#define SERVER_H_

#include <sys/types.h>

#include "niohttp/server.h"

enum niohttp_request_decoder_state {
	NIOHTTP_REQ_LINE,
	NIOHTTP_REQ_HEADERS,
	NIOHTTP_REQ_CONTENT,
};

struct niohttp_request_decoder {
	struct niohttp_headers_decoder *decoder;
	enum niohttp_request_decoder_state state;
	struct niohttp_request *request;
	size_t mark;
	ssize_t offset1;
	ssize_t offset2;
};

int niohttp_request_decoder_parse_line(
		struct niohttp_request_decoder *decoder,
		struct niobuffer *buffer);

int niohttp_request_decoder_parse_header(
		struct niohttp_request_decoder *decoder,
		struct niobuffer *buffer);

struct niohttp_response_encoder {
};

#endif /* SERVER_H_ */
